/*
 * @Author: xiaosihan
 * @Date: 2024-10-20 08:08:12
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2024-10-20 13:55:21
 */

import adminApi from "@api/adminApi";
import { observable, configure } from "mobx";
configure({ enforceActions: "never" });

const adminProcessCategoryStore = observable(
  {
    pageNum: 1, //当前页面
    pageSize: 10, //分页数
    total: 0, //总数
    list: [] as Array<any>, //数据列表
    //请求数据
    async getList(pageNum: number = 1, pageSize: number = 10) {
      this.pageNum = pageNum;
      this.pageSize = pageSize;

      const res = await adminApi.get_user_list({ pageNum, pageSize });
      debugger;

      this.list = []; // 请求数据
    },
    //新增数据
    add(data: any) {
      // 新增完后请求数据
      this.getList();
    },
    //删除数据
    delete(id: string) {
      // 删除完后请求数据
      this.getList();
    },
    //更新数据
    updata(data: any) {
      // 更新完后请求数据
      this.getList();
    },
  },
  {},
  { deep: false }
);
export default adminProcessCategoryStore;
